import React from 'react';
import DataTable from 'components/DataTable';
import Icon from 'components/Icon';
import Button from 'components/Button';
import Upload from 'components/Upload';
import checkbox from "../../../../../components/Form/model/checkbox";
import { Modal } from "antd";

export default (self, dict) => [
    {
        title: '类别',
        name: 'type',
        dict: dict.option_type,
        tableItem: {},
        formItem: {
            type: 'select',
            rules: [
                {
                    required: true,
                    message: '请选择类别'
                }
            ]
        },
        searchItem: {
            type: 'select',
            group: 'abc',
            width: 150,
        }
    },
    {
        title: '名称',
        name: 'name',
        tableItem: {},
        searchItem: {},
        formItem: {
            rules: [
                {
                    required: true,
                    message: '请输入名称'
                },
                {
                    pattern: /^[\W\w\u4E00-\u9FA5]{1,50}$/,
                    message: '名称只能输入1-20个汉字、英文、数字'
                }
            ]
        }
    },
    {
        title: '排序',
        name: 'sort',
        tableItem: {},
        formItem: {
            rules: [
                {
                    pattern: /^[0-9]{1,2}$/,
                    message: '排序无效'
                }
            ]
        }
    },
    {
        title: '备注',
        name: 'notes',
        tableItem: {},
        formItem: {}
    },
    {
        title: '操作',
        tableItem: {
            width: 90,
            fixed: 'right',
            render: (text, record) => (
                <DataTable.Oper>
                    <Button tooltip="修改" onClick={e => self.onUpdate(record)}>
                        <Icon type="edit" />
                    </Button>
                    <Button tooltip="删除" onClick={e => self.onDelete(record)}>
                        <Icon type="trash" />
                    </Button>
                </DataTable.Oper>
            )
        }
    }
];
